package com.api.manage.pojo.finance;

import com.api.manage.base.PageBean;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDateTime;

/**
 * <p>
 * 资金流-业务关联处理
 * </p>
 *
 * @author 陈辉
 * @since 2023-11-06
 */
@Data
@NoArgsConstructor
@ApiModel(value="Bill对象", description="资金流-业务关联处理")
public class BillListBean extends PageBean implements Serializable {

    private static final long serialVersionUID=2348789803451L;

    @ApiModelProperty(value = "资金流-业务关联处理")
    private Long billId;

    @ApiModelProperty(value = "企业")
    private Long sysBranchOfficeId;

    @ApiModelProperty(value = "对应业务类型")
    private Integer refType;
    private String refTypeName;

    @ApiModelProperty(value = "对应业务核销单id")
    private Long refId;

    @ApiModelProperty(value = "线上支付历史 0线下非第三方平台")
    private Long paymentHistoryId;
    private String paymentHistoryIdName;

    @ApiModelProperty(value = "资金账户")
    private Long financeAccountId;
    private String financeAccountIdName;

    //----------
    @ApiModelProperty(value = "业务名称")
    private String name;

    @ApiModelProperty(value = "收款人")
    private Long payeeUserId;

    @ApiModelProperty(value = "收款人姓名")
    private String payeeUserName;

    @ApiModelProperty(value = "支付名称")
    private String payment;

    @ApiModelProperty(value = "支付时间")
    private LocalDateTime payTime;

    @ApiModelProperty(value = "支付金额 负数=支出")
    private BigDecimal payMoney;

    @ApiModelProperty(value = "支付确认人")
    private Long confirmUserId;

    @ApiModelProperty(value = "确认人姓名")
    private String confirmUserName;

    @ApiModelProperty(value = "确认时间")
    private LocalDateTime confirmTime;

    @ApiModelProperty(value = "备注")
    private String msg;

    public void toInit(){
        toSetPaymentHistoryIdName();
        toSetRefTypeName();
    }

    private void toSetPaymentHistoryIdName(){
        if(paymentHistoryId==null || paymentHistoryId.longValue()==0){
            paymentHistoryIdName="线下支付";
        }else{
            paymentHistoryIdName="在线支付";
        }
    }
    private void toSetRefTypeName(){
        int type = refType.intValue();
        if(type==1){
            refTypeName="报销单";
        }else if(type==2){
            refTypeName="采购单";
        }else if(type==3){
            refTypeName="单";
        }else if(type==4){
            refTypeName="单";
        }else if(type==5){
            refTypeName="单";
        }
    }
}
